node {
    def projectName = 'eqxiu-iom-msg-service'
    def projectVersion = '1.5.0.0'

    try {

        stage('Checkout') {
            checkout scm
        }

        stage('Java Build') {
            sh "rm -rf $HOME/.m2/repository/com/eqxiu/eqxiu-user-api/*"
            sh "cd ./$projectName; $JENKINS_HOME/tools/hudson.tasks.Maven_MavenInstallation/mvn-3.5.2/bin/mvn clean package -P test -Dmaven.test.skip=true"
            sh "cd ./$projectName; unzip target/$projectName-*.zip -d target/$projectName"
        }

        stage('Delivery') {
            docker.withRegistry('https://ccr.ccs.tencentyun.com', 'qcloud-docker-registry') {
                docker.build("ccr.ccs.tencentyun.com/eqxiu/$projectName:$projectVersion", ".").push(projectVersion)
            }
        }
    } catch (e) {
        currentBuild.result = "FAILED"
        throw e
    } finally {

    }
}